package com.filetest;

import java.io.*;

public class Xuliehua {
    public static void main(String[] args) throws Exception {
        FileOutputStream fos = new FileOutputStream("D:/grade.obj");
        ObjectOutputStream oos = new ObjectOutputStream(fos);
        Grade g = new Grade(1, "一年级");
        oos.writeObject(g);
        fos.close();
        oos.close();

        FileInputStream fis = new FileInputStream("D:/grade.obj");
        ObjectInputStream ois = new ObjectInputStream(fis);
        Grade gg = (Grade) ois.readObject();
        System.out.println(gg.getA() + ":" + gg.getB());
        fis.close();
        ois.close();

    }
}
